import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'


export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  server: {
	port: 3000,
    proxy: {
      '/api': {
		target: 'https://test.28api.cyou/',
        //target: 'http://156.238.250.73:8881/',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ''),
        ws: true
      },
      '/wsurl': {
        target: 'ws://47.83.186.113:2346',
        ws: true,
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/wsurl/, '')
      }
    }
  }
})
